/**********************************************************************
 * 
 *
 * @url: /services/apexrest/rest
 * @data:
 *  {
        
    }
*************************************************************************/
@RestResource(urlMapping='/CRM/queryUserQuitInfoREST')
global with sharing class QueryUserQuitInfoREST {
    @HttpPost
    global static ResultMessage  doPost(String uid) {

    	if(uid == null  || uid.length() == 0)return new ResultMessage(false,'参数异常!','1');

    	//处理参数
    	while (uid.length() < 6){
    		uid = '0'+ uid ;
    	}
    	System.debug(uid);
    	Integer cnt = [select count() from Account where Owner.EmployeeNumber =:uid ];


        return   new ResultMessage(cnt > 0, cnt == 0 ? 'success' : '存在未转移的客户!', '0'); 
    }

   
    global class ResultMessage{

    	String code;
    	String msg ;
    	Boolean hasaccount;
    	global ResultMessage(Boolean hasaccount ,String msg ,String code){
    		this.code = code;
    		this.hasaccount = hasaccount;
    		this.msg = msg;
    	}	
    }

}